package config

import (
	"flag"
	"fmt"
)

var Config struct {
	Mysql mysqlConfig
	Minio minioConfig
	Redis redisConfig
}

type mysqlConfig struct {
	Url string
}
type minioConfig struct {
	Endpoint        string
	AccessKeyID     string
	SecretAccessKey string
}
type redisConfig struct {
	RedisHost     string
	RedisPort     string
	RedisPassword string
}

func InitConfig() {
	dev := flag.Bool("dev", false, "配置模式")
	flag.Parse()
	fmt.Println(*dev)
	if *dev {
		Config.Mysql = mysqlConfig{Url: "root:990812@tcp(82.156.206.110:4101)/zjxClass?charset=utf8mb4&parseTime=True&loc=Local"}
		Config.Redis = redisConfig{
			RedisHost:     "82.156.206.110",
			RedisPort:     "4103",
			RedisPassword: "990812",
		}
		Config.Minio = minioConfig{
			Endpoint:        "82.156.206.110:4102",
			AccessKeyID:     "minioadmin",
			SecretAccessKey: "minioadmin",
		}
	} else {
		Config.Mysql = mysqlConfig{Url: "root:990812@tcp(zjx_mysql:3306)/zjxClass?charset=utf8mb4&parseTime=True&loc=Local"}
		Config.Redis = redisConfig{
			RedisHost:     "zjx_redis",
			RedisPort:     "6379",
			RedisPassword: "990812",
		}
		Config.Minio = minioConfig{
			Endpoint:        "zjx_minio:9000",
			AccessKeyID:     "mataoxun",
			SecretAccessKey: "mtx990812",
		}
	}

}
